<!--
  * 时间：2025/1/14
  * 作者：刘岩
  * 描述：报警系统 - 设备监测 - 设备组件
-->
<template>
  <div class="device" :class="{'alarm': true}">
    <div class="data-box">
      <span>温度：</span>
      <span>湿度：</span>
    </div>
    <div class="data-box">
      <span>运行状态：</span>
      <span>电压：</span>
    </div>
    <div class="data-box">
      <span>开关状态：</span>
      <span>开关状态：</span>
    </div>
  </div>
</template>

<script>
export default {
  name: 'deviceBox',
  props: {
    // 数据
    data: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      deviceObj: {}
    }
  },
  watch: {
    // 监听数据变化
    data(val) {
      console.log(val)
    }
  }
}
</script>

<style scoped lang="scss">
.device {
  width: 200px;
  height: 300px;
  border-radius: 10px;
  border: 1px solid #e5e5e5;
  margin: 0 10px 10px 10px;
  padding: 5px;
  .data-box {
    font-size: 16px;
    display: flex;
    justify-content: space-between;
  }
}
.alarm {
  border: 1px solid #fa5d5d;
  box-shadow: 0 0 10px rgba(51, 51, 51, 0.5);
  animation: flashingBorder 1s infinite alternate;
}
@keyframes flashingBorder {
  from {
    border-color: #f82a2a;
    box-shadow: 0 0 10px rgba(250, 93, 93, 0.5);
  }
  to {
    border-color: transparent;
    //box-shadow: none;
  }
}
</style>
